<%@page import="com.system.dao.RoleDao"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="../common.jsp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'userEdit.jsp' starting page</title>
    <script type="text/javascript">
    
    	function doSave()
    	{
    		if(doCheck())
    		{
    			var map = Form.formToBean("winForm");
        		map.userId = "${currentUserId}";
        		ajax.remoteCall("com.system.dao.UserDao:editPassword",[map],function(reply){
        			var result = reply.getResult();
        			alert(result.value);
        			if(result.type == "success")
        			{
        				var dlg = Dialog.getInstance("view").close();
        			}
        		});
    		}
    	}
    	
    	function doCheck()
    	{
    		if($.trim($("#currentPassword").val()) == "")
    		{
    			alert("当前密码不能为空");
    			return false;
    		}
    		
    		if($.trim($("#newPassword").val()) == "")
    		{
    			alert("新密码不能为空");
    			return false;
    		}
    		
    		if($.trim($("#repeatPassword").val()) == "")
    		{
    			alert("确定密码不能为空");
    			return false;
    		}
    		
    		if($("#repeatPassword").val() != $("#newPassword").val())
    		{
    			alert("确定密码错误");
    			return false;
    		}
    		return true;
    	}
    	
    </script>
  </head>
  
  <body>
  	<center>
	   <form id="winForm" name="winForm">
	  		<table border="0" cellpadding="0" cellspacing="0" style="margin-top: 20px">
				<tr height="40px">
					<td width="100px" align="right"><font color="#FF0000">*</font>&nbsp;当前密码：</td>
					<td width="180px"><input id="currentPassword" name="currentPassword" type="password" class="textbox" style="width: 200px"/></td>
				</tr>
				<tr height="40px">
					<td width="100px" align="right"><font color="#FF0000">*</font>新的密码：</td>
					<td width="180px">
						<input id="newPassword" name="newPassword" type="password" class="textbox" style="width: 200px"/>
					</td>
				</tr>
				<tr height="40px">
					<td width="100px" align="right"><font color="#FF0000">*</font>确定密码：</td>
					<td width="180px">
						<input id="repeatPassword" name="repeatPassword" type="password" class="textbox" style="width: 200px"/>
					</td>
				</tr>
	  		</table>
		</form>
	</center>
  </body>
</html>
